/* @(#)GSBargainUploadAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-4-21
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import org.apache.struts.upload.FormFile;

import com.hitrust.gs.business.GSBargainProcessor;
import com.hitrust.gs.form.GSBargainAddForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

/**
 * 合同信息文件上传
 */
public class GSBargainUploadAction extends GSBaseAction{

    public String execute(GSBaseForm aForm) throws Exception {
        
        GSBargainAddForm tForm = (GSBargainAddForm)aForm;
        
        FormFile tFile = tForm.getManufactureimage();
        //double fileSize = tFile.getFileSize();
       // byte[] buffer = tFile.getFileData();
        String tPath=tForm.getSession().getServletContext().getRealPath("/upload");
        String tSaveName = tFile.getFileName();
        
        GSBargainProcessor.saveFile(tFile,tPath,tSaveName);
        
        aForm.getRequest().setAttribute("savename", tSaveName);
        
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
